//
//  KRLPreLoginViewController.m
//  KaraLive
//
//  Created by Zhijia Zhong on 2018/9/12.
//  Copyright © 2018年 naxigoren. All rights reserved.
//

#import "KRLPreLoginViewController.h"
#import "KRLLoginViewController.h"
#import "KRLTabBarController.h"

@interface KRLPreLoginViewController ()

@end

@implementation KRLPreLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
}
- (IBAction)didClickLoginButton:(UIButton *)sender {
    KRLLoginViewController *loginViewController = [[KRLLoginViewController alloc] init];
    loginViewController.loginBlcok = ^(BOOL success) {
        if (success) {
            KRLTabBarController *tabBarController = [[KRLTabBarController alloc] init];
            [UIApplication sharedApplication].keyWindow.rootViewController = tabBarController;
        } else {
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"error" message:@"" preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *doneAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            }];
            [alert addAction:doneAction];
            [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alert animated:YES completion:nil];
        }
    };
    [self.navigationController pushViewController:loginViewController animated:YES];
}

- (IBAction)didClickGuestButton:(UIButton *)sender {
    NSLog(@"didClickGuestButton");
}

@end
